package com.fmi.timedealer.moodgame;

import com.fmi.timedealer.moodtracking.Mood;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.view.View;

public class MoodView extends View {
	
	private Mood mood;
	private Paint paint;
	private float x;
	private float y;
	private Bitmap bitmapObject;
	
	public MoodView(Context context, Mood mood, float x, float y) {
		super(context);
		
		this.mood = mood;
		
		paint = new Paint();
		this.bitmapObject = BitmapFactory.decodeResource(context.getResources(), mood.getIcon());
		
		this.x = x;
		this.y = y;
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		
		canvas.drawBitmap(bitmapObject, x, y, paint);
	}

	public Mood getMood() {
		return mood;
	}

	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}
	
	public Point getCenter() {
		return CircleUtils.getCenter((int)x, (int)y, bitmapObject);
	}
	
	public int getRadius() {
		return CircleUtils.getRadius(bitmapObject);
	}
}
